<?php


namespace App\Admin\Extensions\Actions;


use Encore\Admin\Actions\Action;
use Illuminate\Http\Request;

class ImportButton extends Action
{

    public $name = '导入';

    public $selector = '.import-post';


    public function handle(Request $request)
    {
        return $this->response()->success('导入成功')->refresh();
    }

    public function html()
    {
        return <<<HTML
            <a class="btn btn-sm btn-default import-post"><i class="fa fa-upload"></i> 批量导入</a>
HTML;

    }

    public function form()
    {
        $this->file('file', '文件')
            ->options([
                'showPreview' => false,
                'allowedFileExtensions' => ['xlsx'],
            ]);
    }

}
